package com.ccmusic.dao.impl;

import java.util.List;

import com.ccmusic.dao.PersonalListDao;
import com.ccmusic.entity.PersonalList;

public class PersonalListDaoImpl extends BaseDao implements PersonalListDao {

	@Override
	public boolean addList(PersonalList pl) {
		String sql = "insert into personallist values(null,?,?,?)";
		int n = this.execute(sql, pl.getUid(), pl.getLname(), pl.getLcover());
		return n > 0 ? true : false;
	}

	@Override
	public boolean delList(String lid) {
		String sql = "delete from personallist where lid=?";
		int n = this.execute(sql, lid);
		return n > 0 ? true : false;
	}

	@Override
	public List<PersonalList> showPersonalLists(String uid) {
		String sql = "select lname,lcover from personallist where uid=?";
		List<PersonalList> list = (List<PersonalList>) this.select(sql, PersonalList.class, uid);
		return list;
	}

}
